Skip to content

Instantly share code, notes, and snippets.

View sampottinger's full-sized avatar

A Samuel Pottinger sampottinger

View GitHub Profile
@sampottinger
sampottinger / periodic_balls.py
Created August 12, 2026 18:00
Art exercise for nature of code oscillation. Runnable at https://editor.sketchingpy.org/. BSD-3-Claude license.
import math
import time
import sketchingpy
COLOR_SPEEDS = {
'#33333330': 0.2,
'#33333370': 0.4,
'#333333A0': 0.6,
'#333333F0': 0.8
@sampottinger
sampottinger / attractors.py
Created August 5, 2026 17:58
Changing attractors simulation under BSD-3-Clause license runnable in editor.sketchingpy.org.
import math
import random
import sketchingpy
BACKGROUND_COLOR = '#333333'
CENTER_MASS = 10
CENTER_X = 350
CENTER_Y = 350
@sampottinger
sampottinger / bumper_field.py
Last active July 29, 2026 20:34
Sketchingpy players bumping around a vector field. Runnable at https://editor.sketchingpy.org/. BSD-3-Clause license.
import itertools
import math
import random
import statistics
import sketchingpy
MIN_SPEED = 1
MAX_SPEED = 5
@sampottinger
sampottinger / model.py
Last active March 3, 2025 21:55
Example from Lecture 11 using Sketchingpy which draws dev satisfaction from Stack Overflow Developer Survey by age.
"""Data model for a Stack Overflow Dev Satisfaction visualization.
Author: A Samuel Pottinger
License: BSD-3-Clause
"""
import functools
class Dataset:
@sampottinger
sampottinger / tutorial_11.py
Last active February 25, 2025 23:32
Graphic depicting change in fuel standards over time.
"""Graphic depicting change in fuel standards over time.
Graphic depicting change in fuel standards over time using the data first
provided in "Fuel Economy Standards for Autos" by New York Times, 1978.
Part of https://interactivedatascience.courses.
Author: A Samuel Pottinger
License: BSD-3-Clause
"""
@sampottinger
sampottinger / tutorial_10_2.py
Last active February 25, 2025 19:54
Simulation which rotates wheels of colors to combine channels.
"""Simulation which rotates wheels of colors to combine channels.
Simulation which rotates wheels with one wheel per color channel (red, green,
blue). These wheels overlap to show combinations of colors.
Part of https://interactivedatascience.courses.
Author: A Samuel Pottinger
License: BSD-3-Clause
"""
@sampottinger
sampottinger / tutorial_10_1.py
Last active February 25, 2025 19:54
Simulation which rotates wheels of colors to combine channels.
"""Simulation which rotates wheels of colors to combine channels.
Simulation which rotates wheels with one wheel per color channel (red, green,
blue). These wheels overlap to show combinations of colors.
Part of https://interactivedatascience.courses.
Author: A Samuel Pottinger
License: BSD-3-Clause
"""
"""Simulation of bouncing balls with user interaction.
Simulation of bouncing balls with user interaction as an example for
interactivedatascience.courses as part of Tutorial 3.
License: BSD-3-Clause
Author: A Samuel Pottinger
"""
import sketchingpy
# Example for interactivedatascience.courses
# Simulation of bouncing balls with user interaction.
# License: BSD-3-Clause
# Author: A Samuel Pottinger
import sketchingpy
import time
WIDTH = 500 # pixels
HEIGHT = 400 # pixels
# Example for interactivedatascience.courses
# Simulation of bouncing balls without user interaction.
# License: BSD-3-Clause
# Author: A Samuel Pottinger
import sketchingpy
import time
WIDTH = 500 # pixels
HEIGHT = 400 # pixels