User Tools

Site Tools


sample_code:cameraview_color_effect

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

sample_code:cameraview_color_effect [2015/11/28 08:11]
stevegarman created
sample_code:cameraview_color_effect [2016/07/22 17:19]
Line 1: Line 1:
-====== Colour effects ====== 
-The CameraView allows you to add colour effects to the picture. 
  
-This demo shows which effects are available on your device. 
-===== The code ===== 
-<code JavaScript colorEffects.js> 
-var lay,layMnu,cam,lst; 
-function OnStart()  
- 
-    lay = app.CreateLayout( "Absolute" ); 
-    layMnu = app.CreateLayout( "Absolute" ); 
-   
-    cam=app.CreateCameraView(1,1);  
-    cam.SetOnReady(ready);  
-    lay.AddChild(cam); 
- 
-    var btn=app.CreateButton("[fa-bars]",-1,-1,"Custom.fontawesome"); 
-    btn.SetStyle( "#6666ee66", "#6677ff77", 15, "#ff006600", 2, 0 );  
-    btn.SetTextColor("#224422"); 
-    btn.SetOnTouch(toggleMenu); 
-    btn.SetPosition(0.8,0); 
-    lay.AddChild(btn);  
- 
-    lst=app.CreateList("",0.5); 
-    lst.SetBackColor("#cc77ff77"); 
-    lst.SetTextColor("#ff224422"); 
-    //lst.SetTextSize(14); 
-    lst.SetHiTextColor1("#ffddffdd"); 
-    lst.SetOnTouch(effects); 
-    layMnu.SetPosition(0.5,0.1,0.5,1); 
-    layMnu.SetVisibility("Hide"); 
-    layMnu.AddChild(lst); 
-    lay.AddChild(layMnu); 
-          
-    app.AddLayout( lay );  
- 
- 
-function toggleMenu() 
-{ 
-    if(layMnu.GetVisibility()=="Hide") 
-    { 
-       layMnu.Animate("SlideFromRight"); 
-       lay.ChildToFront(layMnu); 
-    } 
-    else 
-       layMnu.Animate("SlideToRight");       
-} 
- 
-function effects(item) 
-{ 
-    cam.SetColorEffect(item); 
-    lst.SelectItem(item); 
-    layMnu.Animate("SlideToRight"); 
-} 
- 
-function ready()  
- 
-     var s = cam.GetColorEffects(); 
-     lst.SetList(s); 
-     lst.SelectItem("none"); 
-     layMnu.Animate("SldeToRight"); 
-     cam.StartPreview(); 
- 
-</code> 
sample_code/cameraview_color_effect.txt · Last modified: 2016/07/22 17:19 (external edit)