Cloud Meditation

Post Reply
gerry
Posts: 7
Joined: Sun Jun 18, 2017 4:50 pm
My devices: iPhone and ipad
Location: Sarnia ON
Flag: Canada

Cloud Meditation

Post by gerry »

Found a cool website called mrdoob.com & modded some webcode from Dav to show it. Cloud anims are good for relaxing when you feel stressed. :D
Tap in upper r corner to stop. I didn't want to show a button.

Code: Select all

'Cloud Meditation by gerry July 2017 adapting some code by Dav, July 2015
'
'FOR IPAD/IPHONE/IPOD TOUCH

' this is the site with cloud fx
home$="http://mrdoob.com/lab/javascript/webgl/clouds/"

'detect device
IF LOWSTR$(DEVICE_TYPE$())="ipad" THEN
  dev=1
ELSE
  dev=0
END IF

GRAPHICS
OPTION SCREENLOCK OFF
OPTION SPRITE POS CENTRAL
OPTION BASE 1
SET BUTTONS CUSTOM

PAGE "main" SET

'init screen
GRAPHICS CLEAR
SET TOOLBAR OFF

SET BROWSERS SCALED 'allow zooming in/out

'get current screen width
curwidth= SCREEN_WIDTH()
curheight=SCREEN_HEIGHT()

'load the homepage with cloud animation
URL$=home$
GOSUB loadpage

DRAW COLOR 0,0,0
FILL COLOR .9,.9,.9

GOSUB makebuttons

'main loop...
DO
  IF BUTTON_PRESSED("quit") THEN END

  'if screen rotated...
  IF SCREEN_WIDTH() <> curwidth THEN
    curwidth = SCREEN_WIDTH()
    URL$=BROWSER_TEXT$("n", "window.location.href")
    GOSUB loadpage
  END IF

UNTIL 0

PAGE bm$ HIDE
PAGE "main" HIDE
TEXT
END


'==========================================
'.  G O S U B S
'==========================================

'-------
loadpage:
'-------

IF dev=1 THEN
  BROWSER "n" AT 0,0 SIZE SCREEN_WIDTH(),SCREEN_HEIGHT()
  BROWSER "n" TEXT g$
  PAUSE 1
  BROWSER "n" URL URL$ 
ELSE
  BROWSER "n" AT 0,0 SIZE SCREEN_WIDTH(),SCREEN_HEIGHT()
  BROWSER "n" TEXT g$
  PAUSE 1
  BROWSER "n" URL URL$ 
END IF
GOSUB makebuttons
RETURN


'----------
makebuttons:
'----------

FILL ALPHA 0
DRAW ALPHA 0
DRAW COLOR .8,.8,.8
IF dev = 1 THEN
  SET BUTTONS FONT SIZE 20
  BUTTON "quit" TEXT "Quit" AT curwidth-50,20 SIZE 40,32
ELSE
  SET BUTTONS FONT SIZE 14
  BUTTON "quit" TEXT "Quit" AT curwidth-30,10
END IF
FILL ALPHA 1
DRAW ALPHA 1
RETURN
Attachments
IMG_2421.PNG
IMG_2421.PNG (1.76 MiB) Viewed 2834 times
IMG_2420.PNG
IMG_2420.PNG (1.53 MiB) Viewed 2834 times
Things go better with code!

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Cloud Meditation

Post by rbytes »

Nice! I enjoy this kind of cloud surfing! :lol:

The mrdoob website you are referencing has a lot of other cool JavaScript effects. I hope you will post some of them too, using your Smart Basic web page loader.
The only thing that gets me down is gravity...

gerry
Posts: 7
Joined: Sun Jun 18, 2017 4:50 pm
My devices: iPhone and ipad
Location: Sarnia ON
Flag: Canada

Re: Cloud Meditation

Post by gerry »

Yep will do.
Things go better with code!

Post Reply