Skip to content

quiero #2

@akevalion

Description

@akevalion
| colors colors2 canvas width height extent h2 random spans dashes perlin limit frameCount particles |
colors := #('083d77' 'ebebd3' 'f4d35e' 'ee964b' 'f95738' '#f24000' '#151023').
colors2 := #('#22577a' '#38a3a5' '#57cc99' '#80ed99' '#c7f9cc' '#ff0000' '#151023').
canvas := RSCanvas new.
canvas clearBackground: false.
canvas color: (Color colorFrom: '#151023').
extent := 1920@1080.
width := extent x.
height := extent y.

h2 := height / 2.
random := Random new.
spans := #(10 20 50 100).
dashes := #(1 10 10000000).
perlin := NSPerlinNoise3 new octaves: 5.

limit := [ :value :max | 
	| res mSq |
	res := value.
	mSq := (value x * value x) + (value y * value y).
	mSq  > (max * max) ifTrue: [
		res := value / mSq sqrt * max
		].
	res ].
frameCount := 0.
particles := (1 to: height by: 4) collect: [ :i|
	| p v a r shape last rSpan dashSpan |
	shape := RSLine new.
	shape capRound.
	shape isFixed: true.
	p := 0@ (i - h2 + h2).
	v := 1@ (i - h2) negated/ 50.
	a := 0.01@0.
	shape color: (Color colorFrom: (colors at: ((i / 50) % colors size + 1) asInteger)).
	r := 1 max: ((random rsNext: 15) * random next * random  next).
	rSpan := spans atRandom.
	dashSpan := dashes atRandom.
	shape propertyAt: #update put: [ 
		| delta |
		last := p.
		p := p + v.
		v := v + a.
		p := p + (((p y/ rSpan) sin * 4) @ ((p x / rSpan) sin * 4)).
		(p x % 20) asInteger = 0 ifTrue: [ 
			v := v+
				((((perlin noise: p x * 100 and: 100000)-0.5)/10)@
				( (perlin noise: p y * 100 and: 5) - 0.5)/10).
			random next < 0.3 ifTrue: [ 
				shape color: (Color colorFrom: { colors. colors2 } atRandom atRandom).
				 ]
		].
		delta := extent/2 - p.
		
		p := p + (limit value: (delta * 0.1) value: 4).
		v := v * 0.99999.
		r := r * 0.99998.
		
		shape width: r.
		(frameCount % dashSpan)< (dashSpan * 0.7) 
			ifTrue: [ shape startPoint: last; endPoint: p. ].
	].
	shape ].

canvas addAll: particles.

canvas newAnimation
	duration: 10 seconds;
	onStepDo: [ 
		particles do: [ :p |
			(p propertyAt: #update) value. ].
		frameCount := frameCount + 0.5.
		canvas signalUpdate.
		 ].
canvas videoExporter
	duration: 10 seconds;
	p1080;
	export
	

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions