Camera Effects

While waiting for my sci.10-1 Teacher to arrive, I was fooling around with putting sprites and colors over a Camera Sprite, and found the Blur Effect and others shown here:

function setup()
    cameraSource(CAMERA_BACK)
    print("Effect 1: Blur\
Made by: CodeaNoob")
    print("Effect 2: Shadow\
Used Cargo-Bot Background fade sprite")
    print("Effect 3: Security Camera\
Created by: CodeaNoob")
    print("Effect 4: Normal\
Normal Camera")
    print("Press Restart to flip the Camera\
WARNING! Cannot be undone until closed.")
    parameter.integer("CameraSelect",1,4)
       end
    function draw()
        Time = os.date("%c")
        if CameraSelect == 1 then
            pushStyle()
            tint(255, 255, 255, 60)
    sprite(CAMERA,WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)
    end
    if CameraSelect == 2 then 
        popStyle()
        pushStyle()
        sprite(CAMERA,WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)
    sprite("Cargo Bot:Background Fade",WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)
    end
    if CameraSelect == 3 then
        popStyle()
        pushStyle()
        sprite(CAMERA,WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)
        rectMode(CENTER)
        fill(0, 0, 0, 255)
        rect(50,750,90,30)
        rect(625,25,243,30)
        font("Inconsolata")
        fontSize(20)
        fill(255, 255, 255, 255)
        text("Camera 1",50,750)
        text(Time,625,25)
        if displayMode() == FULLSCREEN then
            sprite(CAMERA,WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)
            rectMode(CENTER)
            fill(0, 0, 0, 255)
            rect(50,750,90,30)
            rect(900,25,243,30)
            fill(255, 255, 255, 255)
            text(Time,900,25)
            fill(255, 255, 255, 255)
            text("Camera 1",50,750)
            end
        end
    if CameraSelect == 4 then
        popStyle()
        pushStyle()
        sprite(CAMERA,WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)
        end
        end

AWESOME @CodeaNoob Keep it up

How would you make it so the the time goes 1-12 not 1-24? @CodeaNoob

@Andrewsimpson4 - look in the Codea reference under Lua, it explains date/time formats

I cant get it to display the current time. @ignatz

Is the Variable for the os.date in the setup or draw function?

I hate to ask, but is there any way to clean up the code, I don’t like the block of code that it needs for reformatting, and newOrientation is something i’ve never dealt with

Its in the draw function right now. @CodeaNoob

Can u show the code?

Thats good @CodeaNoob ! Great job!

No its very long but what i did was it put a “!” in the os.date so it looks like “os.date(”!%c") because I wated the time to only go up to 12 then back to one. The problem is that its not saying the correct time but when i do it how you did it it is the corect time @CodeaNoob

function draw()
Time = os.date("%c")

@CodeaNoob , I used this to change back camera to frontal camera

parameter.action("Front Camera", function()
                                        cameraSource(CAMERA_FRONT)
                                     end)

    parameter.action("Back Camera",  function()
                                        cameraSource(CAMERA_BACK)
                                     end)
    

@CodeaNoob Tried it out on CC. Looks cool.

Note: That isn’t real night vision :stuck_out_tongue:

Search for NV on here, I made one