creating scrolling credits?

Panda3D Forum Index -> General Discussion Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bestseclub


Posts: 87
Location: Nowhere

PostPosted: Sun Dec 07, 2008 4:30 am    Post subject: creating scrolling credits? Reply with quote
Is there a program(preferably free) that can create a big .png for credits after loading a text file?Like it would be great if it could count the scroll speed depending on the bgm lenght.
What im thinking is to load it into Panda and scroll it down.Dunno if its the best way.
_________________
Irrlicht - IrrEdit - IrrKlang - ArtifexTerra3d - Blender - GIMP - LMMS - Audacity - DevC++ - NSIS
rdb
pro-rsoft

Posts: 5836
Location: Netherlands

PostPosted: Sun Dec 07, 2008 5:47 am    Post subject: Reply with quote
I use the GIMP to create a large image, put it on an OnscreenImage, set the Z position to a low value, and move it upwards.

Alternatively, if you can't create a big PNG, create multiple smaller ones -- and multiple OnscreenImages, then set an offset on each, and reparent them to a bigger dummy node. Then, you can flatten that dummy node and move it upwards.
treeform


Posts: 2027
Location: Seattle

PostPosted: Sun Dec 07, 2008 3:51 pm    Post subject: Reply with quote
why not use the panda3d TextNode and just scroll the text with an interval?
_________________
Panda3d IRC irc://irc.freenode.net/panda3d | BUGs https://bugs.launchpad.net/panda3d
My MMORTS game: http://aff2aw.com
GitHub: http://github.com/treeform | Twitter: http://twitter.com/treeform
ynjh_jo


Posts: 1596
Location: Malang, Indonesia

PostPosted: Mon Dec 08, 2008 4:48 am    Post subject: Reply with quote
And add some fading :
Code:
from pandac.PandaModules import *
from direct.showbase.DirectObject import DirectObject
from direct.gui.DirectGui import *
import direct.directbase.DirectStart
import sys, string, math

globalClock.setMode(ClockObject.MSlave)

def cycleAlpha():
    global VARIANT
    VARIANT=(VARIANT+1)%len(images)
    tex.load(images[VARIANT])

VARIANT=0
images=[]

#_____TOP & BOTTOM FADE
img=PNMImage(32,32)
img.addAlpha()
img.fill(1)
img.alphaFill(1)
for x in range(img.getXSize()):
    for y in range(img.getYSize()):
        img.setAlpha(x,y,-.2+2.5*math.sin(math.pi*y/img.getYSize()))
images.append(img)
#_____SPOTLIGHT
img=PNMImage(32,32)
img.addAlpha()
img.renderSpot(Vec4D(1,1,1,1),Vec4D(1,1,1,0),.6,1)
images.append(img)
#_____DOUGHNUT o_0
img1=PNMImage()
img1.copyFrom(img)
img2=PNMImage(32,32)
img2.addAlpha()
img2.renderSpot(Vec4D(1,1,1,0),Vec4D(1,1,1,1),.1,.4)
img1.darkenSubImage(img2,0,0,0,0)
images.append(img1)

tex=Texture()
tex.load(images[VARIANT])
tex.setWrapU(Texture.WMClamp)
tex.setWrapV(Texture.WMClamp)


# background
osi=OnscreenImage('maps/4map.rgb',parent=render2d)
osi.setColor(.2,.2,.2,1)

# alpha preview
CM=CardMaker('')
card=base.a2dBottomLeft.attachNewNode(CM.generate())
card.setScale(.25)
card.setTexture(tex)
card.setTransparency(1)
ost=OnscreenText(parent=base.a2dBottomLeft, font=loader.loadFont('cmss12'),
   text='press\nSPACE\nto cycle', fg=(0,0,0,1),shadow=(1,1,1,1), scale=.045)
NodePath(ost).setPos(card.getBounds().getCenter()-ost.getBounds().getCenter())

dummyParent=NodePath('')
textParent=dummyParent.attachNewNode('')
textParent.setDepthTest(0)
textParent.setDepthWrite(0)

# THE CREDITS TEXT
ost = OnscreenText(parent=textParent, font=loader.loadFont('cmss12'),
   text='CREDITS\n\n'+'\n'.join([c*30 for c in string.ascii_letters]),
   fg=(1,1,1,1),scale=.065)
ost.setP(-90)
ost.flattenLight()

ts=TextureStage('')
textParent.setTexGen(ts,TexGenAttrib.MWorldPosition)
textParent.setTexScale(ts,.5,.5)
textParent.setTexOffset(ts,.5,.5)
textParent.setTexture(ts,tex)
b3=textParent.getTightBounds()
dims=b3[1]-b3[0]
textParent.posInterval(50,Point3(0,dims[1]+2,0),Point3(0,-1.05,0)).start()

VPcam = Camera('vpcam')
VPcam.copyLens(base.cam2d.node().getLens())
VPcamNP = dummyParent.attachNewNode(VPcam)
VPcamNP.setP(-90)
dr=base.win.makeDisplayRegion()
dr.setCamera(VPcamNP)
dr.setSort(1000)


do=DirectObject()
do.accept('space',cycleAlpha)
do.accept('escape',sys.exit)
globalClock.setMode(ClockObject.MNormal)
run()

_________________
http://ynjh.panda3dprojects.com | http://ynjh.p3dp.com
Intel P4Prescott 2.8GHz HT | Elixir 1.5GB | ATI HD4670 1GB GDDR3
astelix


Posts: 851
Location: Milano, ITA

PostPosted: Mon Dec 08, 2008 11:06 am    Post subject: Reply with quote
you're always not less than amazing ynjh_jo - great snip'
_________________
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
Nemesis#13


Posts: 485
Location: virtual world

PostPosted: Mon Dec 08, 2008 2:08 pm    Post subject: Reply with quote
absolutely awesome ynjh_jo. thank you!
bestseclub


Posts: 87
Location: Nowhere

PostPosted: Tue Dec 09, 2008 12:10 am    Post subject: Reply with quote
This helped a lot and thank you very much Wink
_________________
Irrlicht - IrrEdit - IrrKlang - ArtifexTerra3d - Blender - GIMP - LMMS - Audacity - DevC++ - NSIS
Display posts from previous:   
Post new topic   Reply to topic    Panda3D Forum Index -> General Discussion All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group