Skip to content

Instantly share code, notes, and snippets.

パーティクルシステムがついたオブジェクトを選択し、scripting画面でコードをコピペして、runで実行できます。

bacterial_particle_jp.py:

増殖パーティクルのpythonスニペット。以下の機能を追加することで、疑似的な増殖粒子を作ります。

  • pythonによる制御なしでは、birth timeとlifetimeの間で、各粒子がインデックスの順に均一な間隔で誕生します。これをpythonスクリプトによって、一定間隔で今の倍の粒子が誕生するようにbirth_timeを粒子ごとに割り振ります。
  • さらに、新たに誕生した粒子を既存の粒子の近くに配置することで、粒子の増殖と近似させます。
@squarednob
squarednob / bacterial_particle.py
Created September 30, 2017 19:05
Bacterial particle script for Blender.
import bpy
import numpy as np
import random
# Abbriviations.
obj = bpy.context.object
par_system = obj.particle_systems[0]
particles = par_system.particles
par_setting = particles.data.settings
@squarednob
squarednob / d3-electrophoresis.js
Last active April 13, 2017 06:15
d3-electrophoresis scale change range1
function electrophoresis(config){
// ---------------Dict arguments ----------------
var config = (config === undefined) ? {} : config;
config.DNA = (config.DNA === undefined) ? "AGCGCCCAATACGCAAACCGCCTCTCCCCGCGCGTTGGCCGATTCACGTTTACGAGTTGGAAACGA" : config.DNA;
config.enzymes = (config.enzymes === undefined) ? [[1,5,10,15,20,30,40,50,70,100],"CAAA","GTTGG","GGATCC", "GA",["GT","CCT"],"ACC", "GAAA"] : config.enzymes;
config.names = (config.names === undefined) ? ["marker", "1", "2", "3", "4", "5", "6", "7"]: config.names;
config.scale = (config.scale === undefined) ? d3.scaleSqrt(): config.scale;
config.lane_number = (config.lane_number === undefined) ? 8 : config.lane_number;
config.gel_margin = (config.gel_margin === undefined) ? {top: 40, right: 20, bottom: 30, left: 20} : config.gel_margin;
@squarednob
squarednob / README.md
Last active February 17, 2017 15:26
D3-electrophoresis: Customizing settings with DNA sequence.

D3-electrophoresis plugin example: Default text is a kind of DNA sequence. You can change text and words in text box.

Github: D3-electrophoresis

@squarednob
squarednob / README.md
Last active February 24, 2017 22:09
D3-electrophoresis: Customizing setting with Trump inauguration text

D3-electrophoresis plugin example: Default text is Trump's inauguration speech. You can change text and words in text box.

Github: D3-electrophoresis

@squarednob
squarednob / README.md
Last active February 17, 2017 11:38
D3-electrophoresis: Simple Example
# coding: utf-8
# In[1]:
import numpy as np
import scipy as sp
# matplotlib:
from matplotlib.pylab import plt
import bpy
def dupliOnCurve(curve_length_effect=None, replace=None):
'''
When you want to duplicate an object on object: Simply do "object > make links > object data".
The function is optimised for an object to duplicate on curves, althoubh it can be used to duplicate on objects.
Usage:
1. Multiple selecte curves, and lastly select an object as an object to be duplicated.
2. Paste the code on text editor which can be found in scripting layout.
import bpy
# Meta information.
bl_info = {
"name": "Addon-template1: Add IcoSphere",
"author": "Gappy",
"version": (1, 0),
"blender": (2, 75, 0),
"location": "Object > Ball",
"description": "Add IcoSphere",
@squarednob
squarednob / pseudo-integrate.ipynb
Created February 24, 2016 19:34
Python: Pseudo integrate class
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.