Python 3D Graphics Tutorial 11: Improved Color Orb With Constant Brightness

You guys can help me out over at Patreon, and that will help me keep my gear updated, and help me keep this quality content coming:

https://www.patreon.com/PaulMcWhorter

In this video we show step-by-step instructions on how to program an orb with a smooth and continuous change of color. This is the solution to the homework I gave you in Lesson 10 in this series. We show how to create a mesmerizing orb that smoothly transitions through a range of colors. In this example, we mathematically increment the colors to maintain constant brightness. I do not assume you are an expert, so these lessons are designed for complete beginners.
#Python
#Lessons
#Graphics

source

4 thoughts on “Python 3D Graphics Tutorial 11: Improved Color Orb With Constant Brightness”

• September 22, 2021 at 7:00 pm

I did it just a little differently:
from vpython import *
r=0
g=1
b=1
diferencia=0.01
difR=diferencia
difG=diferencia
difB=diferencia
while True:
rate(29)
miEsfera.color=vector(r,g,b)
if (r<=0 and g>=1 and b>=1):
difR=diferencia
difG=-1*(diferencia)
difB=0
if (r>=1 and g<=0 and b>=1):
difR=0
difG=diferencia
difB=-1*(diferencia)
if (r>=1 and g>=1 and b<=0):
difR=-1*(diferencia)
difG=0
difB=diferencia
r=r+difR
g=g+difG
b=b+difB
print(r+b+g)