Skip to content

Instantly share code, notes, and snippets.

I am attesting that this GitHub handle Ajasra is linked to the Tezos account tz1gQhMM8gNmVwrpnVzR1CQGQNmWoKxrHp8F for tzprofiles
sig:edsigu5PJjQnNPdAUMzgWTRCAEQB6vucomfWr8mDfq3dpnaxDvfYQZwgcWdu6tfb7u6dLSxWMVM2WqDawaJ4Z69ghCxqmxMqbMW
@Ajasra
Ajasra / iospermission.js
Last active October 22, 2020 07:01
As of iOS 13 beta 2, you need to call DeviceOrientationEvent.requestPermission() to access to gyroscope or accelerometer. Users need to accept the request as well as the request needs to be called from a https origin. [link](https://medium.com/fla
<script>
function onClick(){
lg = document.getElementById('log');
lg.innerHTML = "Starting :";
if (typeof DeviceMotionEvent.requestPermission === 'function') {
[Seated camera](https://docs.unrealengine.com/en-US/Platforms/VR/SteamVR/HowTo/SeatedCamera/index.html)
# Basic setup
[docs](https://docs.unrealengine.com/en-US/Platforms/VR/DevelopVR/ContentSetup/index.html)
Create project - Mobile/tablet - Scalable 2d/3D - No starter content
add to Config\DefaultEngine.INI under SystemSettings.
```
[SystemSettings]
vr.PixelDensity=1
r.SeparateTranslucency=0
r.HZBOcclusion=0
void main() {
vec3 color = vec3(0.0);
vec2 st = vUv;
if(st.x > .5) st.x = 1.0 - st.x;
st = st * (1000.0 - pow(st.y, 2.0) * 1000.0);
st = st / 200.0;
color = vec3( cnoise( vec3( st / .05, iTime) ) );
// BLUR
#define blur = mat3(
0.0, 0.2, 0.0,
0.2, 0.2, 0.2,
0.0, 0.2, 0.0
)
#define factor 1.0;
#define bias 0.0;
// rotate
mat2 rotate2d(float _angle){
return mat2(cos(_angle),-sin(_angle),
sin(_angle),cos(_angle));
}
st = rotate2d( sin(u_time)*PI ) * st;
// scale
mat2 scale(vec2 _scale){
// circle
float circle(in vec2 _st, in float _radius){
vec2 dist = _st-vec2(0.5);
return 1.-smoothstep(_radius-(_radius*0.01),
_radius+(_radius*0.01),
dot(dist,dist)*4.0);
}
// box (rect)
float box(in vec2 _st, in vec2 _size){
//------------------------------------------------
float quadraticBezier (float x, float a, float b){
// adapted from BEZMATH.PS (1993)
// by Don Lancaster, SYNERGETICS Inc.
// http://www.tinaja.com/text/bezmath.html
float epsilon = 0.00001;
a = max(0, min(1, a));
b = max(0, min(1, b));
if (a == 0.5){
//------------------------------
float circularEaseIn (float x){
float y = 1 - sqrt(1 - x*x);
return y;
}
//------------------------------
float circularEaseOut (float x){
float y = sqrt(1 - sq(1 - x));
return y;