import numpy as np
from PIL import Image, ImageDraw
r, speed, fps = 20, 40, 24
x1, y1, x2, y2, frames, c = 0.0, 0.0, -0.0, 0.0, [], 0
duration, total_steps, t_increment, t = int(1000 / fps), 640 - r // r, 1 / (640 - r // r), 0
curve_multi = lambda t: t ** 2 / (4 * (t ** 2 - t) + 1)
equation_lhs = lambda x, y, r, x1, y1, x2, y2: r / np.sqrt((x - x1) ** 2 + (y - y1) ** 2) + r / np.sqrt((x - x2) ** 2 + (y - y2) ** 2)
while x1 < 640 - r * 1.5 and x2 > -640 + r * 1.5:
c += 1
X, Y = np.meshgrid(np.linspace(-640, 640, 1280), np.linspace(-64, 64, 128))
Z = equation_lhs(X, Y, r, x1, y1, x2, y2)
image = Image.new("RGBA", (1280, 128), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
for i in range(1280):
for j in range(128):
if Z[j, i] >= 1: draw.point((i, j), fill='white')
t += t_increment
x1 += speed * curve_multi(t)
x2 -= speed * curve_multi(t)
frames.append(image)
while x1 > 0 and x2 < 0:
c += 1
X, Y = np.meshgrid(np.linspace(-640, 640, 1280), np.linspace(-64, 64, 128))
Z = equation_lhs(X, Y, r, x1, y1, x2, y2)
image = Image.new("RGBA", (1280, 128), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
for i in range(1280):
for j in range(128):
if Z[j, i] >= 1: draw.point((i, j), fill='white')
t -= t_increment
x1 -= speed * curve_multi(t)
x2 += speed * curve_multi(t)
frames.append(image)
frames[0].save('dot_morph.gif', save_all=True, append_images=frames[1:], duration=duration, loop=0, disposal=2, transparency=0)
🚩
GitHub Fucked Up My Commit Log
Highlights
- Pro
Pinned Loading
-
-
-
ray_tracing_scene
ray_tracing_scene Public☃️ Sphere Ray-Tracing with Rasterized Particle Simulation
GLSL
-
-
186 contributions in the last year
Day of Week | March Mar | April Apr | May May | June Jun | July Jul | August Aug | September Sep | October Oct | November Nov | December Dec | January Jan | February Feb | |||||||||||||||||||||||||||||||||||||||||
Sunday Sun | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Monday Mon | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Tuesday Tue | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Wednesday Wed | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Thursday Thu | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Friday Fri | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Saturday Sat |
Less
No contributions.
Low contributions.
Medium-low contributions.
Medium-high contributions.
High contributions.
More
Activity overview
Contributed to
abhishtagatya/paleta,
abhishtagatya/backsub-cv,
abhishtagatya/abhishtagatya
and 9 other
repositories
Loading
Contribution activity
February 2025
Created 6 commits in 2 repositories
Created 1 repository
-
abhishtagatya/particle_simulation
GLSL
This contribution was made on Feb 4
1
contribution
in private repositories
Feb 10