Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions Remnant.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import {
View,
Text,
Text,
Image,
Animated,
Dimensions,
Expand All @@ -11,36 +11,36 @@ import {
} from 'react-native';
import { StackNavigator } from 'react-navigation';
import { remnants } from './config';
import Sound from 'react-native-sound';
import Sound from 'react-native-sound';


const height = Dimensions.get('window').height;
const width = Dimensions.get('window').width;

export default class RemnantDisplay extends Component {
constructor(props) {
super(props);
super(props);
this.state = {};

};

render() {
const navigation = this.props.navigation;
const navigation = this.props.navigation;
const image = navigation.getParam('picture', "require('./assets/RemnantsAppearPlate.png')");
const audio = navigation.getParam('audio', 'audiotest3.mp3');

const sound = new Sound(audio);
const myDuration = sound.getDuration;
const duration = myDuration.bind(sound);
const audio = navigation.getParam('audio', 'remnant_1.mp3');

const sound = new Sound(audio);
const myDuration = sound.getDuration;
const duration = myDuration.bind(sound);


return(
<RemnantInteraction
<RemnantInteraction
image={image}
audio={audio}
sound={sound}
duration={duration}
navigation={navigation}
/>
)
}
Expand All @@ -50,39 +50,40 @@ export default class RemnantDisplay extends Component {

class RemnantInteraction extends Component {
constructor({props}){
super(props);
super(props);
this.state = {
pressFade: new Animated.Value(1),
pressHint: new Animated.Value(1)
};
}

fade = ( ) => {
console.log("fade duration " + this.props.duration());
fade = ( ) => {
console.log("fade duration " + this.props.duration());

Animated.timing(this.state.pressFade, {
toValue: 0,
duration: this.props.duration() * 1000,
easing: Easing.out(Easing.cubic)
}).start();
this.props.sound.play();
this.props.sound.play((success) => {
this.props.navigation.navigate("RemnantChooser");
});
}

stopFade = ( ) => {
Animated.timing(this.state.pressFade, {
toValue: 0,
duration: this.props.duration() * 1000,
}).stop();
this.props.sound.pause();
}).stop();

this.props.sound.pause();


this.props.sound.getCurrentTime((seconds) => {
let remaining = this.props.duration() - seconds;
console.log( "elapsed " + seconds + "\nremaining " + remaining );
})
}

}

pressHinter = () => {
Animated.sequence([
Expand Down
Binary file removed android/app/src/main/res/raw/audiotest0.mp3
Binary file not shown.
Binary file removed android/app/src/main/res/raw/audiotest1.mp3
Binary file not shown.
Binary file removed android/app/src/main/res/raw/audiotest2.mp3
Binary file not shown.
Binary file removed android/app/src/main/res/raw/audiotest3.mp3
Binary file not shown.
Binary file removed android/app/src/main/res/raw/audiotest4.mp3
Binary file not shown.
Binary file removed android/app/src/main/res/raw/audiotest5.mp3
Binary file not shown.
Binary file added android/app/src/main/res/raw/remnant_1.mp3
Binary file not shown.
Binary file added android/app/src/main/res/raw/remnant_2.mp3
Binary file not shown.
Binary file added android/app/src/main/res/raw/remnant_3.mp3
Binary file not shown.
Binary file added android/app/src/main/res/raw/remnant_4.mp3
Binary file not shown.
Binary file added android/app/src/main/res/raw/remnant_5.mp3
Binary file not shown.
Binary file added android/app/src/main/res/raw/remnant_6.mp3
Binary file not shown.
Binary file removed audiotest0.mp3
Binary file not shown.
Binary file removed audiotest1.mp3
Binary file not shown.
Binary file removed audiotest2.mp3
Binary file not shown.
Binary file removed audiotest3.mp3
Binary file not shown.
Binary file removed audiotest4.mp3
Binary file not shown.
Binary file removed audiotest5.mp3
Binary file not shown.
18 changes: 9 additions & 9 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,37 +43,37 @@ export const remnants = [
{
id: 1,
picture: require('./assets/remnant1v1v1v1.png'),
audio: 'audiotest3.mp3',
audio: 'remnant_1.mp3',
flex: 2,
},
{
id: 2,
picture: require('./assets/remnant2v1v1v1.png'),
audio: 'audiotest3.mp3',
audio: 'remnant_2.mp3',
flex: 1,
},
{
id: 3,
picture: require('./assets/remnant3v1v1v1.png'),
audio: 'audiotest3.mp3',
audio: 'remnant_3.mp3',
flex: 1,
},
{
id: 4,
picture: require('./assets/remnant4v1v1v1.png'),
audio: 'audiotest3.mp3',
audio: 'remnant_4.mp3',
flex: 2,
},
{
id: 5,
picture: require('./assets/remnant5v1v1v1.png'),
audio: 'audiotest3.mp3',
audio: 'remnant_5.mp3',
flex: 1,
},
{
id: 6,
picture: require('./assets/remnant6v1v1v1.png'),
audio: 'audiotest3.mp3',
audio: 'remnant_6.mp3',
flex: 2,
},
];
Expand All @@ -85,13 +85,13 @@ export const remnants = [
export const remnantsPlaceHolders = [
{id: 0,
image: require('./assets/RemnantsAppearPlate.png'),
audio: 'audiotest1.mp3',
audio: 'remnant_1.mp3',
},{id: 1,
image: require('./assets/CITYORNAMENT5.png'),
audio: 'audiotest2.mp3',
audio: 'remnant_2.mp3',
},{id: 2,
image: require('./assets/Aashiyaan.png'),
audio: 'audiotest‘3.mp3',
audio: 'remnant_3‘.mp3',
},
]

Expand Down