canvas繪製sin正弦曲線
本章節分享一段程式碼例項,利用canvas繪製正弦曲線圖效果。
並且具有動態效果,程式碼例項如下:
[HTML] 純文字檢視 複製程式碼執行程式碼<!DOCTYPE html> <html> <head> <style type="text/css"> #theCanvas{ background-color:#63F; } </style> <script type="text/javascript"> var i = 1; var x = 1; var y = 100; function moveSin(){ var oCanvas=document.getElementById("theCanvas"); var content=oCanvas.getContext( "2d" ); content.beginPath(); content.moveTo(x,y); i+=0.1; x=i*10; y=Math.sin(i)*10+100; content.lineTo(x,y); content.stroke(); content.closePath(); } setInterval(moveSin,10); window.onload=function(){ moveSin(); } </script> </head> <body> <canvas id="theCanvas" width="400" height="400"></canvas> </body> </html>
相關文章
- JavaScript繪製sin正弦函式曲線JavaScript函式
- JavaScript 繪製sin正弦函式曲線JavaScript函式
- html5中canvas繪製貝塞爾曲線HTMLCanvas
- 用canvas繪製一個曲線動畫——深入理解貝塞爾曲線Canvas動畫
- canvas繪製貝濟埃曲線程式碼例項Canvas線程
- html5中canvas貝塞爾曲線繪製菊花HTMLCanvas
- canvas 繪製線條Canvas
- canvas繪製直線Canvas
- canvas 繪製雙線技巧Canvas
- iOS 波浪曲線的繪製iOS
- 怎麼用java繪製曲線Java
- canvas繪製網格射線效果Canvas
- 解析csv資料繪製曲線圖
- ROC曲線繪製與AUC計算
- canvas核心技術-如何繪製線段Canvas
- canvas繪製經典星空連線效果Canvas
- html5中canvas繪製線段HTMLCanvas
- canvas 繪製矩形Canvas
- canvas 繪製扇形Canvas
- canvas 繪製文字Canvas
- canvas繪製拋物線程式碼例項Canvas線程
- html5中canvas線段繪製太陽花HTMLCanvas
- flutter 自定義view 繪製曲線統計圖FlutterView
- Origin教程:DSC曲線的描述和繪製
- webGL入門-四階貝塞爾曲線繪製Web
- canvas 繪製圓形Canvas
- canvas繪製流星效果Canvas
- canvas繪製帶有漸變效果的直線Canvas
- 函式的遞迴及科赫曲線繪製函式遞迴
- MPAndroidChart繪製曲線圖、柱狀圖總結Android
- WPF隨筆收錄-實時繪製心率曲線
- Canvas 繪製雷達圖Canvas
- canvas繪製動畫的技巧Canvas動畫
- canvas 繪製立體圓環Canvas
- canvas 繪製文字詳解Canvas
- canvas 繪製圓角矩形Canvas
- canvas 繪製矩形缺角Canvas
- canvas繪製風車效果Canvas