整合 P5.Sound + a-frame.io
Ref: cdn p5.js and p5.sound.js
cdn : https://cdnjs.com/libraries/p5.js/
Ref: a-frame https://aframe.io/docs/0.8.0/introduction/
1. p5.js example
1-1
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/p5.js"></script>
1-2 初始化設定
1-2-1 function setup() 環境設定
1-2-2 function draw() 定時重繪畫面
1-3 p5.sound 初始化
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/addons/p5.sound.min.js"></script>
1-3-1 function preload() 載入mp3 file
1-3-2 配合 p5.js setup()與draw() 處理聲音同步
1-4 a-frame 3D 架構
<script src="https://aframe.io/releases/0.8.0/aframe.min.js"></script>
1-4-1 3D 場景
<body>內建置<a-scene>場景
1-4-2 draw 取得amp與3D屬性同步修改
1-5 範例
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/addons/p5.sound.min.js"></script>
<script src="https://aframe.io/releases/0.8.0/aframe.min.js"></script>
<script>
function preload(){
sound = loadSound('assets/aa1.mp3');
}
function setup() {
amplitude = new p5.Amplitude();
// start / stop the sound when canvas is clicked
document.addEventListener("click", function(){
if (sound.isPlaying() ){
sound.stop();
} else {
sound.play();
}
});
}
function draw() {
var level = amplitude.getLevel();
var sceneEl = document.querySelector('a-scene');
var sphere1 = sceneEl.querySelector('#sphere1');
sphere1.setAttribute('radius', level * 20);
}
</script>
</head>
<body>
<a-scene>
<a-box color="#4CC3D9" position="-1 0.5 -3" rotation="0 45 0"></a-box>
<a-sphere color="#EF2D5E" id="sphere1" position="0 1.25 -5" radius="1.25"></a-sphere>
<a-cylinder color="#FFC65D" height="1.5" position="1 0.75 -3" radius="0.5"></a-cylinder>
<a-plane color="#7BC8A4" height="4" position="0 0 -4" rotation="-90 0 0" width="4"></a-plane>
<a-sky color="#ECECEC"></a-sky>
</a-scene>
</body>
</html>
2018年7月11日 星期三
2018年6月27日 星期三
HWU VR Project
1. Download html folder
2. Unzip html
3. cmd
4. cd E:\Course1062\project
5. ipconfig
6. dotnet new web -o html
7. 修改 Program.cs
.UseUrls("http://192.168.225.xxx:5000")
8. 修改 Startup,cs
app.UseStaticFiles();
9. Copy html into html
10. cd html
11 dotnet run
12. Chrome http://192.168.225.xxx:5000/s1.html
14. Android http://192.168.225.xxx:5000/s1.html
2018年6月23日 星期六
Taipei city open data example (python)
Ref: https://youtu.be/sUzR3QVBKIo
ASUS X450J @ Windows 10 x 64
Visual Studio 2017 (python)
data ID
http://data.taipei/opendata/datalist/datasetMeta/outboundDesc;jsessionid=D984042CBA68D2341286C1DA0E9DE9C1?id=15c3e1ae-899b-466c-a536-208497e3a369&rid=296acfa2-5d93-4706-ad58-e83cc951863c
取得格式 (http://data.taipei/opendata/developer)
取得全部資料
您可以透過以下取得資料項目id為35aa3c53-28fb-423c-91b6-2c22432d0d70的全部內容:
http://data.taipei/opendata/datalist/apiAccess?scope=resourceAquire
&rid=35aa3c53-28fb-423c-91b6-2c22432d0d70
1. Code
import urllib.request as request
import json
src = "http://data.taipei/opendata/datalist/apiAccess?scope=resourceAquire&rid=296acfa2-5d93-4706-ad58-e83cc951863c"
with request.urlopen(src) as response:
data = json.load(response)
# 取得公司名稱列表
clist = data["result"]["results"]
with open("data.txt", "w", encoding="utf-8") as file:
for company in clist:
file.write(company["公司名稱"] + "\r\n")
ASUS X450J @ Windows 10 x 64
Visual Studio 2017 (python)
data ID
http://data.taipei/opendata/datalist/datasetMeta/outboundDesc;jsessionid=D984042CBA68D2341286C1DA0E9DE9C1?id=15c3e1ae-899b-466c-a536-208497e3a369&rid=296acfa2-5d93-4706-ad58-e83cc951863c
取得格式 (http://data.taipei/opendata/developer)
取得全部資料
您可以透過以下取得資料項目id為35aa3c53-28fb-423c-91b6-2c22432d0d70的全部內容:
http://data.taipei/opendata/datalist/apiAccess?scope=resourceAquire
&rid=35aa3c53-28fb-423c-91b6-2c22432d0d70
1. Code
import urllib.request as request
import json
src = "http://data.taipei/opendata/datalist/apiAccess?scope=resourceAquire&rid=296acfa2-5d93-4706-ad58-e83cc951863c"
with request.urlopen(src) as response:
data = json.load(response)
# 取得公司名稱列表
clist = data["result"]["results"]
with open("data.txt", "w", encoding="utf-8") as file:
for company in clist:
file.write(company["公司名稱"] + "\r\n")
2. 說明
使用 urllib / json 模組
台北市公開資料 (src)
資料首列
{"result":{"offset":0,"limit":10000,"count":5225,"sort":"","results":[{"_id":"1","統編":"04474768","公司名稱":"優鐠電子股份有限公司","公司地址":"114臺北市內湖區瑞光路258巷2號10樓","ADDR_X":"308051.826","ADDR_Y":"2774219.522"}
...
3. 結果
2018年6月16日 星期六
Google app maker
Ref:
https://www.ithome.com.tw/news/123911
https://developers.google.com/appmaker/tutorials/hello-appmaker/
1. login @go.ntaipei.edu.tw
2. https://appmaker.google.com/
3.
Create your app
Sign in to the G Suite account provided by your employer or school.
Open App Maker.
Create a blank app:
If App Maker displays the welcome dialog, click Create New App.
Otherwise, click Menu menu chevron_right New chevron_right Blank Application.
Rename the app. Delete the default name, Untitled App, and enter Hello App Maker.
4. Add TextBox, Button and Label
5. Add Button1.Click
6. Preview
7. Publish
iOS Chrome
Android Chrome
https://www.ithome.com.tw/news/123911
https://developers.google.com/appmaker/tutorials/hello-appmaker/
1. login @go.ntaipei.edu.tw
2. https://appmaker.google.com/
3.
Create your app
Sign in to the G Suite account provided by your employer or school.
Open App Maker.
Create a blank app:
If App Maker displays the welcome dialog, click Create New App.
Otherwise, click Menu menu chevron_right New chevron_right Blank Application.
Rename the app. Delete the default name, Untitled App, and enter Hello App Maker.
4. Add TextBox, Button and Label
6. Preview
7. Publish
iOS Chrome
Android Chrome
2018年4月24日 星期二
ASP.NET Core SDK 固定IP
Testing Platform: ASUS X450J @ Windows 10 x64 / iPhone 5s / Zenfone 5
1. IPConfig ( X450J IP) 確認電腦IP 192.168.27.136
2. dotnet new razor -o Test
3. Open Program.cs
4. Add UseUrls("http://192.168.27.136:8090/")
5. Add Test1.html @ www
6. cd Test
7. dotnet run
8 X450J Chrome 192.168.27.136:8090/Test1.html
9 iPhone Chrome 192.168.27.136:8090/Test1.html
10 zenfone Chrome 192.168.27.136:8090/Test1.html
1. IPConfig ( X450J IP) 確認電腦IP 192.168.27.136
2. dotnet new razor -o Test
3. Open Program.cs
4. Add UseUrls("http://192.168.27.136:8090/")
5. Add Test1.html @ www
6. cd Test
7. dotnet run
8 X450J Chrome 192.168.27.136:8090/Test1.html
9 iPhone Chrome 192.168.27.136:8090/Test1.html
10 zenfone Chrome 192.168.27.136:8090/Test1.html
2018年3月26日 星期一
KinectTileButton 簡化程序
Ref: Kinect SDK 1.8 ControlBasics
Windows 10 Edu x64 @ ASUS X450J
0. New WPF 範本
<!--1 Add Ref Kinect.DLL KinectToolkit.DLL, Kinect.Toolkit.Controls.DLL -->
<!--2 Add xmlns:k 命名空間-->
<!--3 XAML 加入 KinectUserViewer/SensorChooser-->
<!--4 XAML 加入 KinectRegion-->
XAML Code ---
<Window x:Class="wk55.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:k="http://schemas.microsoft.com/kinect/2013"
xmlns:local="clr-namespace:wk55"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<!--1 Add Ref Kinect, Toolkit, toolkit controls-->
<!--2 Add xmlns:k-->
<!--3 Add KinectUserViewer/SensorChooser-->
<!--4 Add KinectRegion-->
<Grid>
<Grid Margin="200 0 200 250">
<k:KinectUserViewer k:KinectRegion.KinectRegion="{Binding ElementName=kinectRegion}" Height="100" HorizontalAlignment="Center" VerticalAlignment="Top" />
<k:KinectSensorChooserUI HorizontalAlignment="Center" VerticalAlignment="Top" Name="sensorChooserUi" />
</Grid>
<k:KinectRegion x:Name="kinectRegion">
<Grid x:Name="kinectRegionGrid" Margin="10,120,10,120">
<k:KinectScrollViewer Name="scrollViewer" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled">
<WrapPanel VerticalAlignment="Center" x:Name="wrapPanel" Orientation="Vertical" k:KinectTileButton.Click="wrapPanel_Click" >
<!-- items for design layout. They will be replaced at runtime. -->
<k:KinectTileButton Label="1"/>
<k:KinectTileButton Label="2"/>
<k:KinectTileButton Label="3"/>
<k:KinectTileButton Label="4"/>
<k:KinectTileButton Label="5"/>
<k:KinectTileButton Label="6"/>
<k:KinectTileButton Label="7"/>
<k:KinectTileButton Label="8"/>
<k:KinectTileButton Label="9"/>
<k:KinectTileButton Label="10"/>
</WrapPanel>
</k:KinectScrollViewer>
</Grid>
</k:KinectRegion>
</Grid>
</Window>
C# Code ---
namespace wk55
{
//5. Add using namespace
using Microsoft.Kinect;
using Microsoft.Kinect.Toolkit;
using Microsoft.Kinect.Toolkit.Controls;
using System.Globalization;
/// <summary>
/// MainWindow.xaml 的互動邏輯
/// </summary>
public partial class MainWindow : Window
{
//6 Add KinectSensorChooser
private readonly KinectSensorChooser sensorChooser;
public MainWindow()
{
InitializeComponent();
//7. Create KinectSensorChooser
this.sensorChooser = new KinectSensorChooser();
KinectSensor.KinectSensors[0].DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
KinectSensor.KinectSensors[0].SkeletonStream.Enable();
this.sensorChooserUi.KinectSensorChooser = this.sensorChooser;
this.sensorChooser.Start();
// Bind the sensor chooser's current sensor to the KinectRegion
var regionSensorBinding = new Binding("Kinect") { Source = this.sensorChooser };
BindingOperations.SetBinding(this.kinectRegion, KinectRegion.KinectSensorProperty, regionSensorBinding);
}
// 8 Add cloing event
private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
this.sensorChooser.Stop();
}
// 9 Add panel click events
private void wrapPanel_Click(object sender, RoutedEventArgs e)
{
var button = (KinectTileButton)e.OriginalSource;
button.Label = "Press";
}
// 10 Copy KinectInteraction180_32.DLL and KinectInteraction180_64.DLL into debug folder
}
}
Windows 10 Edu x64 @ ASUS X450J
0. New WPF 範本
<!--1 Add Ref Kinect.DLL KinectToolkit.DLL, Kinect.Toolkit.Controls.DLL -->
<!--2 Add xmlns:k 命名空間-->
<!--3 XAML 加入 KinectUserViewer/SensorChooser-->
<!--4 XAML 加入 KinectRegion-->
XAML Code ---
<Window x:Class="wk55.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:k="http://schemas.microsoft.com/kinect/2013"
xmlns:local="clr-namespace:wk55"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<!--1 Add Ref Kinect, Toolkit, toolkit controls-->
<!--2 Add xmlns:k-->
<!--3 Add KinectUserViewer/SensorChooser-->
<!--4 Add KinectRegion-->
<Grid>
<Grid Margin="200 0 200 250">
<k:KinectUserViewer k:KinectRegion.KinectRegion="{Binding ElementName=kinectRegion}" Height="100" HorizontalAlignment="Center" VerticalAlignment="Top" />
<k:KinectSensorChooserUI HorizontalAlignment="Center" VerticalAlignment="Top" Name="sensorChooserUi" />
</Grid>
<k:KinectRegion x:Name="kinectRegion">
<Grid x:Name="kinectRegionGrid" Margin="10,120,10,120">
<k:KinectScrollViewer Name="scrollViewer" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled">
<WrapPanel VerticalAlignment="Center" x:Name="wrapPanel" Orientation="Vertical" k:KinectTileButton.Click="wrapPanel_Click" >
<!-- items for design layout. They will be replaced at runtime. -->
<k:KinectTileButton Label="1"/>
<k:KinectTileButton Label="2"/>
<k:KinectTileButton Label="3"/>
<k:KinectTileButton Label="4"/>
<k:KinectTileButton Label="5"/>
<k:KinectTileButton Label="6"/>
<k:KinectTileButton Label="7"/>
<k:KinectTileButton Label="8"/>
<k:KinectTileButton Label="9"/>
<k:KinectTileButton Label="10"/>
</WrapPanel>
</k:KinectScrollViewer>
</Grid>
</k:KinectRegion>
</Grid>
</Window>
C# Code ---
namespace wk55
{
//5. Add using namespace
using Microsoft.Kinect;
using Microsoft.Kinect.Toolkit;
using Microsoft.Kinect.Toolkit.Controls;
using System.Globalization;
/// <summary>
/// MainWindow.xaml 的互動邏輯
/// </summary>
public partial class MainWindow : Window
{
//6 Add KinectSensorChooser
private readonly KinectSensorChooser sensorChooser;
public MainWindow()
{
InitializeComponent();
//7. Create KinectSensorChooser
this.sensorChooser = new KinectSensorChooser();
KinectSensor.KinectSensors[0].DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
KinectSensor.KinectSensors[0].SkeletonStream.Enable();
this.sensorChooserUi.KinectSensorChooser = this.sensorChooser;
this.sensorChooser.Start();
// Bind the sensor chooser's current sensor to the KinectRegion
var regionSensorBinding = new Binding("Kinect") { Source = this.sensorChooser };
BindingOperations.SetBinding(this.kinectRegion, KinectRegion.KinectSensorProperty, regionSensorBinding);
}
// 8 Add cloing event
private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
this.sensorChooser.Stop();
}
// 9 Add panel click events
private void wrapPanel_Click(object sender, RoutedEventArgs e)
{
var button = (KinectTileButton)e.OriginalSource;
button.Label = "Press";
}
// 10 Copy KinectInteraction180_32.DLL and KinectInteraction180_64.DLL into debug folder
}
}
2018年3月13日 星期二
iphone 5 s project to windows 10
Ref:https://as.lonelyscreen.com/download.html
Windows 10 x64 @ ASUS X450J
iphone 5s @ iOS 10
1. Download (Free Trial Download)
2. Install
3. Start LonelyScreen
4. Rotate
Windows 10 x64 @ ASUS X450J
iphone 5s @ iOS 10
1. Download (Free Trial Download)
2. Install
3. Start LonelyScreen
4. Rotate
訂閱:
文章 (Atom)





















