Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

A shadow effect on the text

I came across a video on youtube, the text printed had a photoshop shadow effect, how can this be done with the ; text("Hello World !") example in Codea ?....

Comments

  • dave1707dave1707 Mod
    Posts: 8,456

    @kendog400 Don’t know exactly what you’re looking at, but here’s an example of what looks like shadow text.

    function setup()
        str="hello world"
        fontSize(30)
    end
    
    function draw()
        background(255, 186, 0, 255)
        fill(0)
        text(str,WIDTH/2,HEIGHT/2)
        fill(255)
        text(str,WIDTH/2-2,HEIGHT/2-2)
    end
    
  • Posts: 3

    This is a follow-up to the fine answer by @dave1707.

    I wanted to play around with the parameters a little and get a sense of the actual bounding box, so I moved the text to one corner.

    function setup()  
        parameter.text  ("gString"  ,"hello, great world!")
        parameter.number("gOfsPct"  ,0,100,2)
        parameter.number("gFontSize",0,100,50)    
        parameter.watch ("gTextArea")
    end
    
    function draw()
        background(192)
        
        fontSize(gFontSize)
        w,h = textSize(gString)
        gTextArea = string.format("width=%g,height=%g",w,h)
        
        local ofs = gOfsPct * gFontSize / 100
        fill(128); rectMode(CORNERS); rect(0,0,w+ofs,h+ofs)
        
        textMode(CORNER)
        fill(0);   text(gString,0,0)
        fill(255); text(gString,ofs,ofs)
    end
    
  • dave1707dave1707 Mod
    Posts: 8,456

    @skral Nice job modifying the program. That’s a great way to learn how to do different things.

Sign In or Register to comment.