mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
*** empty log message ***
This commit is contained in:
parent
7cedcb6e06
commit
f0464f40ac
@ -168,3 +168,72 @@ class PosHprScaleInterval(FunctionInterval):
|
|||||||
PosHprScaleInterval.posHprScaleIntervalNum += 1
|
PosHprScaleInterval.posHprScaleIntervalNum += 1
|
||||||
# Create function interval
|
# Create function interval
|
||||||
FunctionInterval.__init__(self, posHprScaleFunc, name = name)
|
FunctionInterval.__init__(self, posHprScaleFunc, name = name)
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
SAMPLE CODE
|
||||||
|
|
||||||
|
### Using lambdas and functions ###
|
||||||
|
# Using a lambda
|
||||||
|
i1 = FunctionInterval(lambda: base.transitions.fadeOut())
|
||||||
|
i2 = FunctionInterval(lambda: base.transitions.fadeIn())
|
||||||
|
# Using a function
|
||||||
|
def printHello():
|
||||||
|
print 'hello'
|
||||||
|
|
||||||
|
i3 = FunctionInterval(printHello)
|
||||||
|
# Create track
|
||||||
|
t = Track([(0.0, i1), (2.0, i2), (4.0, i3)], name = 'demo')
|
||||||
|
# Play track
|
||||||
|
t.play()
|
||||||
|
|
||||||
|
### Specifying interval start times during track construction ###
|
||||||
|
# Interval start time can be specified relative to three different points:
|
||||||
|
# PREVIOUS_END
|
||||||
|
# PREVIOUS_START
|
||||||
|
# TRACK_START
|
||||||
|
|
||||||
|
startTime = 0.0
|
||||||
|
def printStart():
|
||||||
|
global startTime
|
||||||
|
startTime = globalClock.getFrameTime()
|
||||||
|
print 'Start'
|
||||||
|
|
||||||
|
def printPreviousStart():
|
||||||
|
global startTime
|
||||||
|
currTime = globalClock.getFrameTime()
|
||||||
|
print 'PREVIOUS_END %0.2f' % (currTime - startTime)
|
||||||
|
|
||||||
|
def printPreviousEnd():
|
||||||
|
global startTime
|
||||||
|
currTime = globalClock.getFrameTime()
|
||||||
|
print 'PREVIOUS_END %0.2f' % (currTime - startTime)
|
||||||
|
|
||||||
|
def printTrackStart():
|
||||||
|
global startTime
|
||||||
|
currTime = globalClock.getFrameTime()
|
||||||
|
print 'TRACK_START %0.2f' % (currTime - startTime)
|
||||||
|
|
||||||
|
i1 = FunctionInterval(printStart)
|
||||||
|
# Just to take time
|
||||||
|
i2 = LerpPosInterval(camera, 2.0, Point3(0,10,0))
|
||||||
|
# This will be relative to end of camera move
|
||||||
|
i3 = FunctionInterval(printPreviousEnd)
|
||||||
|
# Just to take time
|
||||||
|
i4 = LerpPosInterval(camera, 2.0, Point3(0,0,0))
|
||||||
|
# This will be relative to the start of the camera move
|
||||||
|
i5 = FunctionInterval(printPreviousStart)
|
||||||
|
# This will be relative to track start
|
||||||
|
i6 = FunctionInterval(printTrackStart)
|
||||||
|
# Create the track, if you don't specify offset type in tuple it defaults to
|
||||||
|
# relative to TRACK_START (first entry below)
|
||||||
|
t = Track([(0.0, i1), # i1 start at t = 0, duration = 0.0
|
||||||
|
(1.0, i2, TRACK_START), # i2 start at t = 1, duration = 2.0
|
||||||
|
(2.0, i3, PREVIOUS_END), # i3 start at t = 5, duration = 0.0
|
||||||
|
(1.0, i4, PREVIOUS_END), # i4 start at t = 6, duration = 2.0
|
||||||
|
(3.0, i5, PREVIOUS_START), # i5 start at t = 9, duration = 0.0
|
||||||
|
(10.0, i6, TRACK_START)], # i6 start at t = 10, duration = 0.0
|
||||||
|
name = 'startTimeDemo')
|
||||||
|
t.play()
|
||||||
|
|
||||||
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user